// pages/vote/index.js
const app = getApp()
import {
  urls
} from '../../api/urls'
import {
  dicide_query
} from '../../api/request'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    dicide_type: '',
    dicide_list: [],
    dicide_null: true,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    if (options.type == undefined) {
      wx.setStorageSync('type', '02');
    }
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.setData({
      dicide_null: true,
    })
    this.dicide_query()
  },

  dicide_query() {
    //Para:”[‘物业小区代码’,’功能菜单编号’]”
    console.log('-------------' + app.globalData.cur_property_code)
    var data = {
      para: [app.globalData.cur_property_code,
      wx.getStorageSync('type')
      ]
    }
    dicide_query(data).then(res => {
      this.setData({
        dicide_list: res.data
      })
      if (this.data.dicide_list.length > 0) {
        this.setData({
          dicide_null: false,
        })
      }
    })
  },
  toDoTitle(e) {
    var id = e.currentTarget.dataset.id
    var item = e.currentTarget.dataset.item
    console.log(id)
    wx.navigateTo({
      url: '/pages/vote/toDoTitle?id=' + id + '&item=' + JSON.stringify(item)
    })
  },

})